import React, { Component } from 'react'
import { createRef } from 'react'

export default class RefDemo extends Component {
  input1=null
  input2 = createRef()
  render() {
    return (
      <>
        <input type="text" ref={e => {this.input1 = e}} onBlur={() => {if(this.input1.value){alert(this.input1.value)}}} />
        <input type="text" ref={this.input2} onBlur={() => {
          if(this.input2.current.value){alert(this.input2.current.value)}
        }} />
      </>
    )
  }
}
